package utils;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Common {
	/**
     * Gets a list of matching strings with a given regular expression
     * @param regex Regular expression
     * @param characterSequence Character sequence to evaluate
     * @return Matching sequences
     */
    public static List<String> getMatches(String regex, String characterSequence) {
            
            Pattern patt = Pattern.compile(regex);
            Matcher mat = patt.matcher(characterSequence);
            
            List<String> matches = new ArrayList<String>();
            while (mat.find()) {
                    matches.add(mat.group());
            }
            
            return matches;
            
    }
}
